---
title: Checkbox Group
description: Provides shared state to a series of checkboxes.

links:
  doc: https://base-ui.com/react/components/checkbox-group#api-reference
---

<ComponentPreview name="p-checkbox-group-1" />

## Installation

<CodeTabs>

<TabsList>
  <TabsTab value="cli">CLI</TabsTab>
  <TabsTab value="manual">Manual</TabsTab>
</TabsList>
<TabsPanel value="cli">

```bash
npx shadcn@latest add @coss/checkbox-group
```

</TabsPanel>

<TabsPanel value="manual">

<Steps>

<Step>Install the following dependencies:</Step>

```bash
npm install @base-ui-components/react
```

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource
  name="checkbox-group"
  title="components/ui/checkbox-group.tsx"
/>

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsPanel>

</CodeTabs>

## Usage

```tsx
import { Checkbox } from "@/components/ui/checkbox"
import { CheckboxGroup } from "@/components/ui/checkbox-group"
```

```tsx
<CheckboxGroup>
  <Label>
    <Checkbox defaultChecked />
    Next.js
  </Label>
  <Label>
    <Checkbox />
    Vite
  </Label>
  <Label>
    <Checkbox />
    Astro
  </Label>
</CheckboxGroup>
```

## Examples

For accessible group labelling and validation, prefer wrapping checkbox groups with `Field` and `Fieldset`. See the related example: [Checkbox group field](/ui/docs/components/field#checkbox-group-field).

### With Disabled Item

<ComponentPreview name="p-checkbox-group-2" />

### Parent Checkbox

<ComponentPreview name="p-checkbox-group-3" />

### Nested Parent Checkbox

<ComponentPreview name="p-checkbox-group-4" />

### Form Integration

<ComponentPreview name="p-checkbox-group-5" />
